home *** CD-ROM | disk | FTP | other *** search
/ Aminet 28 / Aminet 28 (1998)(GTI - Schatztruhe)[!][Dec 1998].iso / Aminet / util / libs / MMULib.lha / MMULib / Lib_Sources / mu_context.i < prev    next >
Encoding:
Text File  |  1998-10-04  |  9.1 KB  |  163 lines

  1. ;*************************************************************************
  2. ;** mmu.library                                                         **
  3. ;**                                                                     **
  4. ;** a system library for arbitration and control of the MC68K MMUs      **
  5. ;**                                                                     **
  6. ;** © 1998 THOR-Software, Thomas Richter                                **
  7. ;** No commercial use, reassembly, modification without prior, written  **
  8. ;** permission of the authors.                                          **
  9. ;** Including this library in any commercial software REQUIRES a        **
  10. ;** written permission and the payment of a small fee.                  **
  11. ;**                                                                     **
  12. ;** This is an internal header file, do not depend on anything here.    **
  13. ;** Use the official include files.                                     **
  14. ;** Distributed only for the mmu.library development group for private  **
  15. ;** use.                                                                **
  16. ;**                                                                     **
  17. ;**---------------------------------------------------------------------**
  18. ;** Block: The context                                                  **
  19. ;** Definition of the "Context", the basic object of the mmu.lib        **
  20. ;*************************************************************************
  21.  
  22. ;FOLD Context
  23. ;*************************************************
  24. ;** Context                                     **
  25. ;** This defines the Context structure.         **
  26. ;** It keeps informations about a MMU table     **
  27. ;*************************************************
  28.         rsreset
  29. ctx_succ:               rs.l 1
  30. ctx_pred:               rs.l 1          ;doubly linked list
  31. ctx_type:               rs.b 1          ;NT_CONTEXT
  32. ctx_pri:                rs.b 1          ;unused
  33. ctx_name:               rs.l 1          ;name of this context, if any
  34.  
  35. ctx_usecount:           rs.w 1          ;context use count
  36.  
  37. ctx_cpstart:            rs.b 0
  38. ctx_RootMask:           rs.l 1          ;this has to be filled in with -1, the root has to be masked by the setup code itself
  39.                                         ;lookup tables for the MMU table builder
  40. ctx_LevelAMask:         rs.l 1          ;alignment of the LevelA pointer table pointed to by the MMU URP
  41. ctx_LevelBMask:         rs.l 1
  42. ctx_LevelCMask:         rs.l 1
  43. ctx_LevelDMask:         rs.l 1
  44. ctx_IndirectMask:       rs.l 1          ;Alignment for indirect
  45. ctx_PageMask:           rs.l 1          ;Alignment at page level
  46.  
  47.                                         ;the mask +1 is called alignment
  48.                                         ;it is therefore the alignment of
  49.                                         ;the object ONE LEVEL BELOW
  50.                                         ;since at the level above only the
  51.                                         ;bits mentioned in the mask are
  52.                                         ;used.
  53.  
  54. ctx_LevelAAlign:        rs.l 1          ;alignment of the LevelA pointer table pointed to by the MMU URP
  55. ctx_LevelBAlign:        rs.l 1
  56. ctx_LevelCAlign:        rs.l 1
  57. ctx_LevelDAlign:        rs.l 1
  58. ctx_IndirectAlign:      rs.l 1          ;Alignment for indirect: Unused (must be four anyways)
  59. ctx_PageSize:           rs.l 0          ;Page size choosen. Should be 4K
  60. ctx_PageAlign:          rs.l 1          ;Alignment at page level: This is identical to the page size
  61.  
  62. ctx_InitialShift:       rs.b 1          ;Initial shift bits, only used for MC68851/MC68030
  63. ctx_LevelABits:         rs.b 1          ;Bits for the Root Index level of the tree
  64. ctx_LevelBBits:         rs.b 1          ;Bits for the Pointer Index level of the tree
  65. ctx_LevelCBits:         rs.b 1          ;Bits for the Page Index level of the tree
  66. ctx_LevelDBits:         rs.b 1          ;Bits for the Level D pointer, used only in MC68851/68030
  67. ctx_PageBits:           rs.b 1          ;Bits for the Page Offset level of the tree
  68.  
  69. ctx_InitialPos:         rs.b 1          ;always zero
  70. ctx_LevelAPos:          rs.b 1          ;Bit position of the MSB bit for the LevelA decoding. Bit 0 IS LEFTMOST. Optimized for bfextu
  71. ctx_LevelBPos:          rs.b 1
  72. ctx_LevelCPos:          rs.b 1
  73. ctx_LevelDPos:          rs.b 1
  74. ctx_PagePos:            rs.b 1
  75.                                         ;the remaining lookups are filled in by the library itself
  76. ctx_UpperEnd:           rs.l 1          ;Total upper end of the address space (0 for 2^32)
  77. ctx_LevelASize:         rs.l 1          ;Size of an early-termination page at level A
  78. ctx_LevelBSize:         rs.l 1
  79. ctx_LevelCSize:         rs.l 1
  80. ctx_LevelDSize:         rs.l 1
  81.  
  82. ctx_InitialSz:          rs.l 1
  83. ctx_LevelATableSz:      rs.l 1          ;Size in entries of the pointer table at level A (not counting the user data)
  84. ctx_LevelBTableSz:      rs.l 1
  85. ctx_LevelCTableSz:      rs.l 1
  86. ctx_LevelDTableSz:      rs.l 1
  87. ctx_PageTableSz:        rs.l 1          ;Size of the MMU page table
  88.  
  89. ctx_cpend:              rs.b 0
  90.  
  91. ctx_flags:              rs.l 1          ;flags, see below
  92.  
  93. ctx_Mapping:            rs.l 3          ;hardware independent mapping
  94. ctx_RootPointer:        rs.l 2          ;hardware dependent root pointer
  95. ctx_Root:               rs.l 1          ;CPU readable address of the MMU
  96.                                         ;base table
  97.  
  98. ctx_Semaphore:          rs.b $2e        ;access to this structure
  99.                                         ;the next onces are the switch
  100.                                         ;and lauch entries for tasks
  101.                                         ;added to this context.
  102.                                         ;this works with a little magic
  103.                                         ;a part of this structure is
  104.                                         ;run as code (Urgh)
  105. ctx_SwitchEntry:        rs.w 3          ;A JSR $xxxx
  106. ctx_LaunchEntry:        rs.w 3          ;A JSR $xxxx
  107. ctx_len:                rs.b 0
  108. ;ENDFOLD
  109. ;FOLD Flags
  110. ctxf_global     =       10      ;this context contains the GLOBAL MMU table attributes
  111. ctxf_active     =       24      ;this context is currently "loaded"
  112. ctxf_dirty      =       31      ;this context needs rebuild
  113. ;ENDFOLD
  114. ;FOLD MapNode
  115. ;*************************************************
  116. ;** MapNode                                     **
  117. ;** this structure describes the properties of  **
  118. ;** the memory for the given context            **
  119. ;*************************************************
  120.         rsreset
  121. map_succ:               rs.l 1          ;doubly linked
  122. map_pred:               rs.l 1          ;list
  123. map_lower:              rs.l 1          ;lower address
  124. map_higher:             rs.l 1          ;higher address, inclusive
  125. map_Mask:               rs.l 0          ;if this is used to modify a context: Property mask here
  126. map_MMUNode:            rs.l 1          ;pointer for the MMU node describing this
  127. map_Flags:              rs.l 1          ;see below
  128. map_Properties:         rs.l 1          ;properties of this block
  129. map_Delta:              rs.l 0          ;alternatively: The difference (!) between the logical and the physical address
  130.                                         ;added to the logical address to get the physical address
  131. map_UserPtr:            rs.l 1          ;for user data if invalid, or for memory destination if indirect
  132. map_len:                rs.b 0
  133. ;ENDFOLD
  134. ;FOLD MapNode properties
  135. ;*************************************************
  136. ;** MapNode properties                          **
  137. ;*************************************************
  138. mapp_writeprotected     =       2       ;page is write protected
  139. mapp_cacheinhibit       =       6       ;cache inhibit (if on, bit 5 is precise or imprecise exception)
  140. mapp_supervisoronly     =       7       ;page is supervisor code only
  141.  
  142. mapp_userpage0          =       8       ;user page attributes 0
  143. mapp_userpage1          =       9       ;user page attributes 1
  144. mapp_global             =       10      ;this is the global (public) context
  145. mapp_blank              =       11      ;there's no memory at this space. Must be tolerated.
  146. mapp_copyback           =       13      ;copyback mode allowed (only if cachable, '040, '060)
  147. mapp_invalid            =       14      ;access of this page causes a segmentation fault
  148. mapp_remapped           =       15      ;the physical memory is elsewhere. Use the userptr
  149. mapp_swapped            =       16      ;access of this page causes a swapper exception
  150. mapp_rom                =       17      ;ROM. Write access quietly tolerated.
  151. mapp_shared             =       18      ;shares the table of the global NULL context
  152. mapp_translated         =       19      ;the address space is transparently translated. Do not touch.
  153. mapp_imprecise          =       21      ;imprecise exception mode (only if non-cacheable, '060)
  154. mapp_indirect           =       22      ;pointer to a user provided page descriptor
  155. mapp_bundled            =       23      ;almost identical to indirect except that all consequent pages are mapped to one address space
  156. mapp_nonserialized      =       29      ;nonserialized access allowed (only if noncacheable, '040)
  157. ;ENDFOLD
  158. ;FOLD MapNode flags
  159. mapf_dirty              =       31      ;this map has not been translated to the MMU yet
  160. ;ENDFOLD
  161.  
  162.  
  163.